from django.contrib import admin
from stew.cheese.models import NaturalLanguage, ProgrammingLanguage, Environment, Utterance, VoiceCommand

class SimpleAdmin(admin.ModelAdmin):
    def __init__(self, model, admin_site, fields):
        admin.ModelAdmin.__init__(self, model, admin_site)
        self.list_display = fields
        self.list_filter = fields
        self.ordering = fields
        self.search_fields = fields


class NaturalLanguageAdmin(SimpleAdmin):
    def __init__(self, model, admin_site):
        SimpleAdmin.__init__(self, model, admin_site, ('identifier', 'name'))

class ProgrammingLanguageAdmin(SimpleAdmin):
    def __init__(self, model, admin_site):
        SimpleAdmin.__init__(self, model, admin_site, ('name', 'grammar'))

class EnvironmentAdmin(SimpleAdmin):
    def __init__(self, model, admin_site):
        SimpleAdmin.__init__(self, model, admin_site, ('name', 'version'))

admin.site.register(NaturalLanguage, NaturalLanguageAdmin)
admin.site.register(ProgrammingLanguage, ProgrammingLanguageAdmin)
admin.site.register(Environment, EnvironmentAdmin)
admin.site.register(Utterance)
admin.site.register(VoiceCommand)
